<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>DragImage</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">DragImage()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#006666"><b>DragImage</b></font>(ImageID [, Actions])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Starts a Drag &amp; Drop operation with image data. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>ImageID</i></td>
<td width="90%"> 
 
The image to drag. <a href="../image/imageid.html">ImageID()</a> can be used to get this ID for an image. 

 

</td></tr>
<tr><td><i>Actions (optional)</i></td>
<td> 
 
A combination of the Drag &amp; Drop actions that should be allowed for the image. 
If the parameter is not specified, <font color="#924B72">#PB_Drag_Copy</font> will be the only allowed action. 
Possible actions are: (they can be combined with '|') 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Drag_Copy</font>: The image can be copied
  <font color="#924B72">#PB_Drag_Move</font>: The image can be moved
  <font color="#924B72">#PB_Drag_Link</font>: The image can be linked
</font></pre>



The user can decide which of these actions to take by pressing modifier keys like Ctrl or Shift. The actions 
that can really be taken also depend on the actions allowed by the drop target. 
(On MacOSX, the actions are only treated as a suggestion. The drop target can still choose another action.) 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns one of the above Drag &amp; Drop action values to indicate what action the user took, or 
<font color="#924B72">#PB_Drag_None</font> if the user aborted the Drag &amp; Drop operation. 
<br>
<br>
Note that if <font color="#924B72">#PB_Drag_Move</font> is returned, it is your responsibility to remove the 
dragged image from your application. 

 

</blockquote><p><b>Remarks</b></p><blockquote>



Drag &amp; Drop can basically be started any time, but the 
left mouse button should be currently pressed as otherwise the operation will end immediately without success. 
The usual time to start a Drag &amp; Drop operation is when a <a href="../gadget/index.html">Gadget</a> reported an event with 
<a href="../window/eventtype.html">EventType()</a> of <font color="#924B72">#PB_EventType_DragStart</font>. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#006666">; Drag the image to an application that can accept images like an office or graphic program.</font>
  <font color="#006666">;</font>
  <b><font color="#006666">If</font></b> <font color="#006666">LoadImage</font>(1, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/data/PureBasicLogo.bmp")
    <b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(1, 200, 200, 400, 90, "Drag &amp; Drop", <font color="#924B72">#PB_Window_SystemMenu</font>)
<font color="#006666">      ImageGadget</font>(1, 10, 10, 380, 70,<font color="#006666"> ImageID</font>(1))
    
      <b><font color="#006666">Repeat</font></b>
        Event =<font color="#006666"> WaitWindowEvent</font>()      
        <b><font color="#006666">If</font></b> Event = <font color="#924B72">#PB_Event_Gadget</font> <b><font color="#006666">And</font></b> <font color="#006666">EventGadget</font>() = 1 <b><font color="#006666">And</font></b> <font color="#006666">EventType</font>() = <font color="#924B72">#PB_EventType_DragStart</font>
<font color="#006666">          DragImage</font>(<font color="#006666">ImageID</font>(1))
        <b><font color="#006666">EndIf</font></b>      
      <b><font color="#006666">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
    <b><font color="#006666">EndIf</font></b>
  <b><font color="#006666">EndIf</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="dragfiles.html">DragFiles()</a>, <a href="dragtext.html">DragText()</a>, <a href="dragprivate.html">DragPrivate()</a>, <a href="dragosformats.html">DragOSFormats()</a>, 
<a href="setdragcallback.html">SetDragCallback()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=dragfiles.html>DragFiles()</a> - <a href=index.html>DragDrop Index</a> - <a href=dragosformats.html>DragOSFormats()</a> -&gt;



</body></html>